

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/fluid.png">
  <link rel="icon" href="/img/fluid.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="John Doe">
  <meta name="keywords" content="">
  
    <meta name="description" content="@[toc] 以往课设记录  Web期末课程设计v1.0（一） | 大学生闲置物品交易系统 | 选择页面模板（附资源），使用 JQuery AJAX实现注册、登陆  Web期末课程设计v1.0（二） | 大学生闲置物品交易系统 | 使用Bootstrap5各组件优化页面，使用AJAX请求实现用户修改信息功能   运行环境  windows10 IDEA专业版 JDK8 HTML5、CSS3、Jav">
<meta property="og:type" content="article">
<meta property="og:title" content="Web项目实战 _ 购物系统v1.0 _ 开发记录（三） _ 基于Bootstrap设计商品页面、使用JQuery实现上传文件并显示到图片组件、使用JSTL标签显示数据库的内容到无序列表">
<meta property="og:url" content="http://example.com/2021/12/21/Web%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98%20_%20%E8%B4%AD%E7%89%A9%E7%B3%BB%E7%BB%9Fv1.0%20_%20%E5%BC%80%E5%8F%91%E8%AE%B0%E5%BD%95%EF%BC%88%E4%B8%89%EF%BC%89%20_%20%E5%9F%BA%E4%BA%8EBootstrap%E8%AE%BE%E8%AE%A1%E5%95%86%E5%93%81%E9%A1%B5%E9%9D%A2%E3%80%81%E4%BD%BF%E7%94%A8JQuery%E5%AE%9E%E7%8E%B0%E4%B8%8A%E4%BC%A0%E6%96%87%E4%BB%B6%E5%B9%B6%E6%98%BE%E7%A4%BA%E5%88%B0%E5%9B%BE%E7%89%87%E7%BB%84%E4%BB%B6%E3%80%81%E4%BD%BF%E7%94%A8JSTL%E6%A0%87%E7%AD%BE%E6%98%BE%E7%A4%BA%E6%95%B0%E6%8D%AE%E5%BA%93%E7%9A%84%E5%86%85%E5%AE%B9%E5%88%B0%E6%97%A0%E5%BA%8F%E5%88%97%E8%A1%A8/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:description" content="@[toc] 以往课设记录  Web期末课程设计v1.0（一） | 大学生闲置物品交易系统 | 选择页面模板（附资源），使用 JQuery AJAX实现注册、登陆  Web期末课程设计v1.0（二） | 大学生闲置物品交易系统 | 使用Bootstrap5各组件优化页面，使用AJAX请求实现用户修改信息功能   运行环境  windows10 IDEA专业版 JDK8 HTML5、CSS3、Jav">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://img-blog.csdnimg.cn/1a244381ea744e369b611fff130a2407.png#pic_center">
<meta property="og:image" content="https://img-blog.csdnimg.cn/cd7e7c41200f472398a430ac034c7b78.png#pic_center">
<meta property="og:image" content="https://img-blog.csdnimg.cn/0b588597632842429c426407eecbf249.png#pic_center">
<meta property="og:image" content="https://img-blog.csdnimg.cn/1960513a80aa4e3095fd1256d6ac3765.png#pic_center">
<meta property="og:image" content="https://img-blog.csdnimg.cn/763902a1ff294b8ebeeb13efb7407b30.png#pic_center">
<meta property="og:image" content="https://img-blog.csdnimg.cn/dc854a0b257e4e99926ecea7c4f7fe36.png#pic_center![%E5%9C%A8%E8%BF%99%E9%87%8C%E6%8F%92%E5%85%A5%E5%9B%BE%E7%89%87%E6%8F%8F%E8%BF%B0](https://img-blog.csdnimg.cn/7938174f854c474aa1f3158f3d04305f.png)">
<meta property="og:image" content="https://img-blog.csdnimg.cn/0f96bcf6d544413093dd826b85f472e1.png#pic_center">
<meta property="og:image" content="https://img-blog.csdnimg.cn/a2c11029cc2b418f987fa6518551a28a.png#pic_center">
<meta property="og:image" content="https://img-blog.csdnimg.cn/fbb9cd3276b04d76bcb7b09ee984f531.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/cab2dcde175d49fe86360e6fc24ae011.png#pic_center">
<meta property="og:image" content="https://img-blog.csdnimg.cn/1e0237d370284b70a92a86cc4cd97147.png#pic_center">
<meta property="og:image" content="https://img-blog.csdnimg.cn/c62697566df64040b0e67fefa5961911.png#pic">
<meta property="og:image" content="https://img-blog.csdnimg.cn/592a2d3ff38a4c2d8f2342cf135fb7dd.png#pic_center">
<meta property="og:image" content="https://img-blog.csdnimg.cn/8d457e0241884f678de9823ce7492b0f.png#pic_center">
<meta property="og:image" content="https://img-blog.csdnimg.cn/f2e3ec5e271c4b9a8319fb03afb7f7a4.png">
<meta property="article:published_time" content="2021-12-21T02:33:01.000Z">
<meta property="article:modified_time" content="2022-08-22T15:50:28.426Z">
<meta property="article:author" content="John Doe">
<meta property="article:tag" content="JavaWeb">
<meta property="article:tag" content="项目实战:购物系统v1.0">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://img-blog.csdnimg.cn/1a244381ea744e369b611fff130a2407.png#pic_center">
  
  
  
  <title>Web项目实战 _ 购物系统v1.0 _ 开发记录（三） _ 基于Bootstrap设计商品页面、使用JQuery实现上传文件并显示到图片组件、使用JSTL标签显示数据库的内容到无序列表 - Hexo</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/css/highlight-dark.css" />
  




  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"example.com","root":"/","version":"1.9.2","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"follow_dnt":true,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml"};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
  


  
<meta name="generator" content="Hexo 6.2.0"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 70vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>尤 Ni&#39;s Blog</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              &nbsp;<i class="iconfont icon-search"></i>&nbsp;
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/img/default.png') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="Web项目实战 _ 购物系统v1.0 _ 开发记录（三） _ 基于Bootstrap设计商品页面、使用JQuery实现上传文件并显示到图片组件、使用JSTL标签显示数据库的内容到无序列表"></span>
          
        </div>

        
          
  <div class="mt-3">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-author" aria-hidden="true"></i>
        John Doe
      </span>
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2021-12-21 10:33" pubdate>
          2021年12月21日 上午
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          6.6k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          55 分钟
        
      </span>
    

    
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">Web项目实战 _ 购物系统v1.0 _ 开发记录（三） _ 基于Bootstrap设计商品页面、使用JQuery实现上传文件并显示到图片组件、使用JSTL标签显示数据库的内容到无序列表</h1>
            
              <p class="note note-info">
                
                  
                    本文最后更新于：1 小时前
                  
                
              </p>
            
            
              <div class="markdown-body">
                
                <p>@[toc]</p>
<h1 id="以往课设记录"><a href="#以往课设记录" class="headerlink" title="以往课设记录"></a>以往课设记录</h1><hr>
<ul>
<li><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/Unirithe/article/details/122028999">Web期末课程设计v1.0（一） | 大学生闲置物品交易系统 | 选择页面模板（附资源），使用 JQuery AJAX实现注册、登陆</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/Unirithe/article/details/122035714">Web期末课程设计v1.0（二） | 大学生闲置物品交易系统 | 使用Bootstrap5各组件优化页面，使用AJAX请求实现用户修改信息功能</a></p>
</li>
</ul>
<h1 id="运行环境"><a href="#运行环境" class="headerlink" title="运行环境"></a>运行环境</h1><hr>
<ul>
<li>windows10</li>
<li>IDEA专业版</li>
<li>JDK8</li>
<li>HTML5、CSS3、JavaScript</li>
<li>JQuery</li>
<li>Bootstrap5</li>
</ul>
<h1 id="1-页面效果展示"><a href="#1-页面效果展示" class="headerlink" title="1. 页面效果展示"></a>1. 页面效果展示</h1><hr>
<p>和前两次的风格不同，这次先将所有的页面展示出来，然后再分别对一些关键功能的实现进行记录。</p>
<h2 id="1-1-主页面"><a href="#1-1-主页面" class="headerlink" title="1.1 主页面"></a>1.1 主页面</h2><p>主页面的修改只是删除了原先的LOGO图片，将其调整到了商品页面。</p>
<p><strong>原先的页面：</strong><br><img src="https://img-blog.csdnimg.cn/1a244381ea744e369b611fff130a2407.png#pic_center" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br><strong>修改后的页面：</strong><br><img src="https://img-blog.csdnimg.cn/cd7e7c41200f472398a430ac034c7b78.png#pic_center" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<h2 id="1-2-商品页面"><a href="#1-2-商品页面" class="headerlink" title="1.2 商品页面"></a>1.2 商品页面</h2><p>该页面是刚设计出来的，基于其他购物网站的结构，笔者这里简要的把几个要素展示了出来、分别是商品分类、商品卡片、分页按钮。</p>
<p>目前来说，它仅仅是一个静态布局，还没有连接到数据库。</p>
<p><img src="https://img-blog.csdnimg.cn/0b588597632842429c426407eecbf249.png#pic_center" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<h2 id="1-3-发布商品页面"><a href="#1-3-发布商品页面" class="headerlink" title="1.3 发布商品页面"></a>1.3 发布商品页面</h2><p>由于是大学生的闲置物品交易平台，除了购买商品以外，当然也有发布商品的功能，但并不是每个用户都能发布，所以笔者构思可能还需要给用户添加一个字段表示是否有权限去发布商品，然后用户可以在用户中心申请权限到后台，后台经一个后台管理页面来确认是否赋予用户发布的权限。<br><img src="https://img-blog.csdnimg.cn/1960513a80aa4e3095fd1256d6ac3765.png#pic_center" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p>点击图片按钮后可上传本地的图片，并在图片组件中显示</p>
<p><img src="https://img-blog.csdnimg.cn/763902a1ff294b8ebeeb13efb7407b30.png#pic_center" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<h1 id="2-功能实现的步骤"><a href="#2-功能实现的步骤" class="headerlink" title="2. 功能实现的步骤"></a>2. 功能实现的步骤</h1><hr>
<h2 id="2-1-商品标签-Badge"><a href="#2-1-商品标签-Badge" class="headerlink" title="2.1 商品标签 Badge"></a>2.1 商品标签 Badge</h2><p>实现效果图:<br><img src="https://img-blog.csdnimg.cn/dc854a0b257e4e99926ecea7c4f7fe36.png#pic_center![%E5%9C%A8%E8%BF%99%E9%87%8C%E6%8F%92%E5%85%A5%E5%9B%BE%E7%89%87%E6%8F%8F%E8%BF%B0](https://img-blog.csdnimg.cn/7938174f854c474aa1f3158f3d04305f.png)" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br>该组件的实现是使用了Bootstrap5框架的Badge组件，它的效果就是一个按钮带一个小徽章，这里将按钮的内容用来表示商品的类别，按钮上的徽章则用来表示该类别的统计个数，使得用户可直观的看到每个商品类别的个数。</p>
<p><a target="_blank" rel="noopener" href="https://v5.bootcss.com/docs/components/badge/">Bootstrap5 Badge 官方文档</a><br><img src="https://img-blog.csdnimg.cn/0f96bcf6d544413093dd826b85f472e1.png#pic_center" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br><strong>官方代码：</strong></p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><code class="hljs html"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">&quot;button&quot;</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;btn btn-primary position-relative&quot;</span>&gt;</span><br>  Inbox<br>  <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger&quot;</span>&gt;</span><br>    99+<br>    <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;visually-hidden&quot;</span>&gt;</span>unread messages<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span><br>  <span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br></code></pre></td></tr></table></figure>

<h2 id="2-2-商品小卡片-Card"><a href="#2-2-商品小卡片-Card" class="headerlink" title="2.2 商品小卡片 Card"></a>2.2 商品小卡片 Card</h2><p>实现效果图：<br><img src="https://img-blog.csdnimg.cn/a2c11029cc2b418f987fa6518551a28a.png#pic_center" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p>该卡片组件同样是Bootstrap5框架自带的，它可以用来表示一个商品，里面有图片组件、商品描述、按钮等等，主要是用来归纳多个组件。</p>
<p><a target="_blank" rel="noopener" href="https://v5.bootcss.com/docs/components/card/">Bootstrap5 Card 官方文档</a><br><img src="https://img-blog.csdnimg.cn/fbb9cd3276b04d76bcb7b09ee984f531.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br>这里笔者使用了一行四个小卡片的布局方式，实现的关键HTML代码如下：</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br></pre></td><td class="code"><pre><code class="hljs html"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;container&quot;</span>&gt;</span><br>     <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;row&quot;</span>&gt;</span><br>        	<span class="hljs-comment">&lt;!-- 第一个商品小卡片 --&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;col-3&quot;</span>&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><br>                	<span class="hljs-comment">&lt;!-- 商品图片 --&gt;</span><br>                    <span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">&quot;...&quot;</span> &gt;</span><br>                    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;card-body&quot;</span>&gt;</span><br>                   	       <span class="hljs-comment">&lt;!-- 商品文字描述... --&gt;</span><br>                    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br>                <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br>            <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br>			<span class="hljs-comment">&lt;!-- 第二个商品小卡片 --&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;col-3&quot;</span>&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><br>                	<span class="hljs-comment">&lt;!-- 商品图片 --&gt;</span><br>                    <span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">&quot;...&quot;</span> &gt;</span><br>                    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;card-body&quot;</span>&gt;</span><br>                   	       <span class="hljs-comment">&lt;!-- 商品文字描述... --&gt;</span><br>                    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br>                <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br>            <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br>			<span class="hljs-comment">&lt;!-- 第三个商品小卡片 --&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;col-3&quot;</span>&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><br>                	<span class="hljs-comment">&lt;!-- 商品图片 --&gt;</span><br>                    <span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">&quot;...&quot;</span> &gt;</span><br>                    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;card-body&quot;</span>&gt;</span><br>                   	       <span class="hljs-comment">&lt;!-- 商品文字描述... --&gt;</span><br>                    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br>                <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br>            <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br>			<span class="hljs-comment">&lt;!-- 第四个商品小卡片 --&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;col-3&quot;</span>&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><br>                	<span class="hljs-comment">&lt;!-- 商品图片 --&gt;</span><br>                    <span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">&quot;...&quot;</span> &gt;</span><br>                    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;card-body&quot;</span>&gt;</span><br>                   	       <span class="hljs-comment">&lt;!-- 商品文字描述... --&gt;</span><br>                    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br>                <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br>            <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br>      <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br></code></pre></td></tr></table></figure>
<h2 id="2-3-分页组件-Pagination"><a href="#2-3-分页组件-Pagination" class="headerlink" title="2.3 分页组件 Pagination"></a>2.3 分页组件 Pagination</h2><p>实现的两种分页效果<br><img src="https://img-blog.csdnimg.cn/cab2dcde175d49fe86360e6fc24ae011.png#pic_center" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p><img src="https://img-blog.csdnimg.cn/1e0237d370284b70a92a86cc4cd97147.png#pic_center" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br>框架的分页主要是用一个无序列表结合a标签实现的。</p>
<p><a target="_blank" rel="noopener" href="https://v5.bootcss.com/docs/components/pagination/">bootstrap5 Pagination 官方文档</a><br><img src="https://img-blog.csdnimg.cn/c62697566df64040b0e67fefa5961911.png#pic" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<h2 id="2-4-JQuery实现上传图片"><a href="#2-4-JQuery实现上传图片" class="headerlink" title="2.4 JQuery实现上传图片"></a>2.4 JQuery实现上传图片</h2><p>实现效果图：<br><img src="https://img-blog.csdnimg.cn/592a2d3ff38a4c2d8f2342cf135fb7dd.png#pic_center" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br>在HTML中，使用一个上传文件的组件方式如下：</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs html"><span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">&quot;file&quot;</span>&gt;</span><br></code></pre></td></tr></table></figure>
<p>默认input file的效果不太美观，而且大小也有局限，现有一个思路去替换这种样式<br><img src="https://img-blog.csdnimg.cn/8d457e0241884f678de9823ce7492b0f.png#pic_center" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p><strong>替换input file思路：</strong></p>
<ul>
<li>定义一个按钮，里面放一个图片，用于显示上传的图片，同时支持点击上传图片</li>
<li>将input标签放在一个按钮组件，将这个按钮采用绝对布局方式，和上面的按钮组件进行重合，并对这两个按钮同时设置边框。</li>
<li>重合后，将input所在的按钮透明度设置零，并将该组件放在在重合的另一个按钮组件前面，这样就保证用户点击的实际是一个透明的input标签，但是最终看到的则是显示图片的一个图片按钮。</li>
<li>最后使用JS代码监听这个input标签的状态，一旦修改，就使用JS代码去获取到上传的图片资源，同时限制这个文件的格式，指定为图片格式。</li>
</ul>
<p>关于JS监听input组件的参考博文（<strong>侵删</strong>）： <a target="_blank" rel="noopener" href="https://www.cnblogs.com/aipan/p/8268819.html">jquery实时监听输入框值变化</a></p>
<p>显示上传图片的HTML代码:</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><code class="hljs html"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;form-publish-img-parent&quot;</span>&gt;</span><br>  <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;form-publish-img&quot;</span> <span class="hljs-attr">type</span>=<span class="hljs-string">&quot;file&quot;</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;d-block&quot;</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br><br><span class="hljs-tag">&lt;<span class="hljs-name">button</span>&gt;</span><br>  <span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;form-publish-img-show&quot;</span> <span class="hljs-attr">src</span>=<span class="hljs-string">&quot;img/add_image.jpg&quot;</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br></code></pre></td></tr></table></figure>
<p>实现的JS (JQuery 3.6.0插件)  代码如下：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><code class="hljs javascript">$(<span class="hljs-string">&quot;#form-publish-img&quot;</span>).<span class="hljs-title function_">bind</span>(<span class="hljs-string">&quot;input propertychange&quot;</span>,<span class="hljs-keyword">function</span>(<span class="hljs-params">event</span>)&#123;<br>      <span class="hljs-keyword">var</span> reads = <span class="hljs-keyword">new</span> <span class="hljs-title class_">FileReader</span>();<br>      <span class="hljs-keyword">var</span> f = $(<span class="hljs-variable language_">this</span>).<span class="hljs-title function_">get</span>(<span class="hljs-number">0</span>).<span class="hljs-property">files</span>[<span class="hljs-number">0</span>];<br>      <span class="hljs-keyword">var</span> rep = <span class="hljs-regexp">/jpeg|png|gif|bmp|jpg/ig</span>;<br>      <span class="hljs-keyword">var</span> gstyle = f.<span class="hljs-property">type</span>.<span class="hljs-title function_">split</span>(<span class="hljs-string">&quot;/&quot;</span>)[<span class="hljs-number">1</span>];<br>      <span class="hljs-keyword">if</span>(rep.<span class="hljs-title function_">test</span>(gstyle))&#123;<br>           reads.<span class="hljs-title function_">readAsDataURL</span>(f);<br>           reads.<span class="hljs-property">onload</span> = <span class="hljs-keyword">function</span>(<span class="hljs-params">e</span>) &#123;<br>                   $(<span class="hljs-string">&quot;#form-publish-img-show&quot;</span>).<span class="hljs-title function_">attr</span>(<span class="hljs-string">&quot;src&quot;</span>,<span class="hljs-variable language_">this</span>.<span class="hljs-property">result</span>)<br>               &#125;;<br>      &#125;<span class="hljs-keyword">else</span>&#123;<br>           <span class="hljs-title function_">alert</span>(<span class="hljs-string">&quot;图片格式不正确，请上传 jpeg|png|gif|bmp|jpg 格式的图片&quot;</span>)<br>      &#125;<br>  &#125;)<br></code></pre></td></tr></table></figure>
<p>实现重合的CSS样式:</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><code class="hljs css"><span class="hljs-comment">/* 图片的配置  设置input标签的样式*/</span><br><span class="hljs-selector-class">.form-publish-img-parent</span>, <span class="hljs-selector-id">#form-publish-img</span>&#123;<br>    <span class="hljs-comment">/*border: solid; !*测试时显示边框样式*!*/</span><br>    <span class="hljs-attribute">position</span>: absolute;<br>    <span class="hljs-attribute">width</span>: <span class="hljs-number">600px</span>;<br>    <span class="hljs-attribute">height</span>: <span class="hljs-number">400px</span>;<br>&#125;<br><span class="hljs-selector-id">#form-publish-img-show</span>&#123;<br>    <span class="hljs-attribute">width</span>: <span class="hljs-number">600px</span>;<br>    <span class="hljs-attribute">height</span>: <span class="hljs-number">400px</span>;<br>&#125;<br><span class="hljs-selector-class">.form-publish-img-parent</span>&#123;<br>    <span class="hljs-attribute">opacity</span>: <span class="hljs-number">0</span>;<br>&#125;<br><span class="hljs-selector-id">#form-publish-img</span>&#123;<br>    <span class="hljs-attribute">top</span>: <span class="hljs-number">0px</span>;<br>&#125;<br></code></pre></td></tr></table></figure>

<h2 id="2-5-JSTL实现显示数据库里的商品类型"><a href="#2-5-JSTL实现显示数据库里的商品类型" class="headerlink" title="2.5 JSTL实现显示数据库里的商品类型"></a>2.5 JSTL实现显示数据库里的商品类型</h2><p><strong>实现效果：</strong><br><img src="https://img-blog.csdnimg.cn/f2e3ec5e271c4b9a8319fb03afb7f7a4.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<h3 id="2-5-1-导入JSTL"><a href="#2-5-1-导入JSTL" class="headerlink" title="2.5.1 导入JSTL"></a>2.5.1 导入JSTL</h3><ul>
<li>在pom.xml中导入依赖</li>
</ul>
<p><code>pom.xml</code></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>javax.servlet.jsp.jstl<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>jstl-api<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>1.2<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span><br><br><span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.apache.taglibs<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>taglibs-standard-impl<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>1.2.5<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span><br></code></pre></td></tr></table></figure>

<ul>
<li>在JSP文件中导入JSTL</li>
</ul>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs html">&lt;%@ taglib uri = &quot;http://java.sun.com/jsp/jstl/core&quot; prefix=&quot;c&quot;%&gt;<br></code></pre></td></tr></table></figure>
<h3 id="2-5-2-将JSTL语句嵌入到JSP页面"><a href="#2-5-2-将JSTL语句嵌入到JSP页面" class="headerlink" title="2.5.2 将JSTL语句嵌入到JSP页面"></a>2.5.2 将JSTL语句嵌入到JSP页面</h3><p>实现的JSP代码</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><code class="hljs html"><span class="hljs-tag">&lt;<span class="hljs-name">select</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;...&quot;</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;commodityType&quot;</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">c:if</span> <span class="hljs-attr">test</span>=<span class="hljs-string">&quot;$&#123;not empty commodityTypes&#125;&quot;</span>&gt;</span><br>   <span class="hljs-tag">&lt;<span class="hljs-name">c:forEach</span> <span class="hljs-attr">items</span>=<span class="hljs-string">&quot;$&#123;commodityTypes&#125;&quot;</span> <span class="hljs-attr">var</span>=<span class="hljs-string">&quot;ct&quot;</span>&gt;</span><br>     <span class="hljs-tag">&lt;<span class="hljs-name">option</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;$&#123;ct.id&#125;&quot;</span>&gt;</span><br>       $&#123;ct.info&#125;<br>     <span class="hljs-tag">&lt;/<span class="hljs-name">option</span>&gt;</span><br>   <span class="hljs-tag">&lt;/<span class="hljs-name">c:forEach</span>&gt;</span><br> <span class="hljs-tag">&lt;/<span class="hljs-name">c:if</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">select</span>&gt;</span><br></code></pre></td></tr></table></figure>

<p>在上述代码中，commodityTypes对象是 通过session域获取的，实现如下:</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs java">List&lt;CommodityType&gt; commodityTypes = (ArrayList&lt;CommodityType&gt;) session.getAttribute(<span class="hljs-string">&quot;commodityTypes&quot;</span>);<br></code></pre></td></tr></table></figure>

<h3 id="2-5-3-实现查询商品类型的dao、action层"><a href="#2-5-3-实现查询商品类型的dao、action层" class="headerlink" title="2.5.3 实现查询商品类型的dao、action层"></a>2.5.3 实现查询商品类型的dao、action层</h3><p><strong>dao层关键代码：</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><code class="hljs java"><span class="hljs-meta">@Override</span><br><span class="hljs-keyword">public</span> List&lt;CommodityType&gt; <span class="hljs-title function_">queryAllType</span><span class="hljs-params">()</span> &#123;<br>    List&lt;CommodityType&gt; list = <span class="hljs-keyword">new</span> <span class="hljs-title class_">ArrayList</span>&lt;&gt;();<br>    <span class="hljs-type">Connection</span> <span class="hljs-variable">connection</span> <span class="hljs-operator">=</span> DruidUtil.getConnection();<br>    <span class="hljs-type">String</span> <span class="hljs-variable">sql</span> <span class="hljs-operator">=</span> <span class="hljs-string">&quot;select * from commodity_type&quot;</span>;<br>    <span class="hljs-keyword">try</span> &#123;<br>        <span class="hljs-type">PreparedStatement</span> <span class="hljs-variable">pstmt</span> <span class="hljs-operator">=</span> connection.prepareStatement(sql);<br>        <span class="hljs-type">ResultSet</span> <span class="hljs-variable">rs</span> <span class="hljs-operator">=</span> pstmt.executeQuery();<br>        <span class="hljs-keyword">while</span>(rs.next())&#123;<br>            list.add(<span class="hljs-keyword">new</span> <span class="hljs-title class_">CommodityType</span>(rs.getInt(<span class="hljs-number">1</span>), rs.getString(<span class="hljs-number">2</span>)));<br>        &#125;<br>    &#125; <span class="hljs-keyword">catch</span> (Exception e)&#123;<br>        e.printStackTrace();<br>    &#125;<br>    <span class="hljs-keyword">return</span> list;<br>&#125;<br></code></pre></td></tr></table></figure>
<p>action层即请求与响应处理层，笔者使用的思路就是在用户登陆成功时在读取商品类型并将结果对象存储到session域名，其关键代码为：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><code class="hljs java"><span class="hljs-meta">@WebServlet(name = &quot;UserLoginServlet&quot;, urlPatterns = &quot;/toLogin&quot;)</span><br><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">UserLoginServlet</span> <span class="hljs-keyword">extends</span> <span class="hljs-title class_">HttpServlet</span> &#123;<br><span class="hljs-comment">//    UserService userService = new UserServiceImpl();</span><br>    <span class="hljs-meta">@Override</span><br>    <span class="hljs-keyword">protected</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">doGet</span><span class="hljs-params">(HttpServletRequest req, HttpServletResponse resp)</span> <span class="hljs-keyword">throws</span> ServletException, IOException &#123;<br>        resp.getWriter().write(<span class="hljs-string">&quot;无法使用Get请求进行登陆&quot;</span>);<br>    &#125;<br><br>    <span class="hljs-meta">@Override</span><br>    <span class="hljs-keyword">protected</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">doPost</span><span class="hljs-params">(HttpServletRequest req, HttpServletResponse resp)</span> <span class="hljs-keyword">throws</span> ServletException, IOException &#123;<br>        <span class="hljs-type">String</span> <span class="hljs-variable">name</span> <span class="hljs-operator">=</span> req.getParameter(<span class="hljs-string">&quot;username&quot;</span>);<br>        <span class="hljs-type">String</span> <span class="hljs-variable">password</span> <span class="hljs-operator">=</span> req.getParameter(<span class="hljs-string">&quot;password&quot;</span>);<br>        <span class="hljs-type">User</span> <span class="hljs-variable">user</span> <span class="hljs-operator">=</span> Service.user.checkUser(name, password);<br>        <span class="hljs-keyword">if</span>(user == <span class="hljs-literal">null</span>)&#123;<br>            resp.getWriter().write(<span class="hljs-string">&quot;false&quot;</span>);<br>        &#125; <span class="hljs-keyword">else</span>&#123;<br>            <span class="hljs-comment">/* 登陆成功 */</span><br><br>            <span class="hljs-comment">/* 保存商城的商品类型到 session 域 */</span><br>            req.getSession().setAttribute(<span class="hljs-string">&quot;commodityTypes&quot;</span>, Service.commodity.queryAllType());<br>            <span class="hljs-comment">/* 保存用户信息到 session域 */</span><br>            req.getSession().setAttribute(<span class="hljs-string">&quot;userInfo&quot;</span>, user);<br>            resp.getWriter().write(<span class="hljs-string">&quot;true&quot;</span>);<br>        &#125;<br>    &#125;<br>&#125;<br></code></pre></td></tr></table></figure>

<h1 id="3-总结"><a href="#3-总结" class="headerlink" title="3. 总结"></a>3. 总结</h1><hr>
<p>这一次的时间大部分在UI设计上，虽然看起来还是比较简陋，但是基本的功能，比如：查看商品、发布商品已经可以实现了，接下来需要继续完善发布商品的功能，需要考虑图片如何存储在数据库中的问题。</p>
<h1 id="下一部分"><a href="#下一部分" class="headerlink" title="下一部分"></a>下一部分</h1><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/Unirithe/article/details/122098853">Web期末课程设计v1.0（四） | 大数据闲置物品交易系统 | 实现JQuery图片上传 | 使用JQ插件提交AJAX请求实现发布商品并保存到数据库 | 商品分类分页显示</a></p>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/categories/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98-%E8%B4%AD%E7%89%A9%E7%B3%BB%E7%BB%9Fv1-0/" class="category-chain-item">项目实战:购物系统v1.0</a>
  
  

      </span>
    
  
</span>

    </div>
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/tags/JavaWeb/">#JavaWeb</a>
      
        <a href="/tags/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98-%E8%B4%AD%E7%89%A9%E7%B3%BB%E7%BB%9Fv1-0/">#项目实战:购物系统v1.0</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>Web项目实战 _ 购物系统v1.0 _ 开发记录（三） _ 基于Bootstrap设计商品页面、使用JQuery实现上传文件并显示到图片组件、使用JSTL标签显示数据库的内容到无序列表</div>
      <div>http://example.com/2021/12/21/Web项目实战 _ 购物系统v1.0 _ 开发记录（三） _ 基于Bootstrap设计商品页面、使用JQuery实现上传文件并显示到图片组件、使用JSTL标签显示数据库的内容到无序列表/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>John Doe</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2021年12月21日</div>
        </div>
      
      
      <div class="license-meta-item">
        <div>许可协议</div>
        <div>
          
            
            
              <a target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
              <span class="hint--top hint--rounded" aria-label="BY - 署名">
                <i class="iconfont icon-by"></i>
              </span>
              </a>
            
          
        </div>
      </div>
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2021/12/23/Web%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98%20_%20%E8%B4%AD%E7%89%A9%E7%B3%BB%E7%BB%9Fv1.0%20_%20%E5%BC%80%E5%8F%91%E8%AE%B0%E5%BD%95%EF%BC%88%E5%9B%9B%EF%BC%89%20_%20%E5%AE%9E%E7%8E%B0JQuery%E5%9B%BE%E7%89%87%E4%B8%8A%E4%BC%A0%20_%20%E4%BD%BF%E7%94%A8JQ%E6%8F%92%E4%BB%B6%E6%8F%90%E4%BA%A4AJAX%E8%AF%B7%E6%B1%82%E5%AE%9E%E7%8E%B0%E5%8F%91%E5%B8%83%E5%95%86%E5%93%81%E5%B9%B6%E4%BF%9D%E5%AD%98%E5%88%B0%E6%95%B0%E6%8D%AE%E5%BA%93%20_%20%E5%95%86%E5%93%81%E5%88%86%E7%B1%BB%E5%88%86%E9%A1%B5%E6%98%BE%E7%A4%BA/" title="Web项目实战 _ 购物系统v1.0 _ 开发记录（四） _ 实现JQuery图片上传 _ 使用JQ插件提交AJAX请求实现发布商品并保存到数据库 _ 商品分类分页显示">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">Web项目实战 _ 购物系统v1.0 _ 开发记录（四） _ 实现JQuery图片上传 _ 使用JQ插件提交AJAX请求实现发布商品并保存到数据库 _ 商品分类分页显示</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2021/12/20/Web%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98%20_%20%E8%B4%AD%E7%89%A9%E7%B3%BB%E7%BB%9Fv1.0%20_%20%E5%BC%80%E5%8F%91%E8%AE%B0%E5%BD%95%EF%BC%88%E4%BA%8C%EF%BC%89%20_%20%E4%BD%BF%E7%94%A8Bootstrap5%E5%90%84%E7%BB%84%E4%BB%B6%E4%BC%98%E5%8C%96%E9%A1%B5%E9%9D%A2%EF%BC%8C%E4%BD%BF%E7%94%A8AJAX%E8%AF%B7%E6%B1%82%E5%AE%9E%E7%8E%B0%E7%94%A8%E6%88%B7%E4%BF%AE%E6%94%B9%E4%BF%A1%E6%81%AF%E5%8A%9F%E8%83%BD/" title="Web项目实战 _ 购物系统v1.0 _ 开发记录（二） _ 使用Bootstrap5各组件优化页面，使用AJAX请求实现用户修改信息功能">
                        <span class="hidden-mobile">Web项目实战 _ 购物系统v1.0 _ 开发记录（二） _ 使用Bootstrap5各组件优化页面，使用AJAX请求实现用户修改信息功能</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
    </div>
  
  
  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.0/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.18.2/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      headingSelector : CONFIG.toc.headingSelector || 'h1,h2,h3,h4,h5,h6',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      collapseDepth   : CONFIG.toc.collapseDepth || 0,
      scrollSmooth    : true,
      headingsOffset  : -boardTop
    });
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.10/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/js/local-search.js" ></script>





<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
